export function list2Tree(list, pid) {
  const result = []
  list.forEach((item) => {
    if (item.pid === pid) {
      const children = list2Tree(list, item.id)

      if (children.length > 0) {
        item.children = children
      }

      result.push(item)
    }
  })

  return result
}
